package com.orifine.orm.type;

import com.orifine.orm.Information;
import com.orifine.orm.Type;
import com.orifine.orm.information.BooleanRandomInfo;
import com.orifine.orm.model.ColumnModel;

public class BooleanType extends Type{
	private Boolean value;
	
	public BooleanType(){
		
	}
	
	public BooleanType(Boolean value){
		this.value = value;
	}
	
	@Override
	public String getScriptType(ColumnModel column) {
		return "BIT(1)";
	}

	@Override
	public String getScriptValue(ColumnModel column) {
		if(value == null) return "NULL";
		else {
			if(value){
				return "1";
			} else {
				return "0";
			}
		}
	}

	@Override
	public Information getDefaultInfo(ColumnModel column) {
		return new BooleanRandomInfo();
	}
}
